#!/bin/bash

set -e
COL='\033[1;32m'
NC='\033[0m' # No Color
echo -e "${COL}Setting up fluidd"

echo -e "${COL}Installing dependencies...\n${NC}"
# install required dependencies
apk add curl nginx openrc

echo -e "${COL}Downloading fluidd\n${NC}"
mkdir /fluidd && cd /fluidd
curl -o fluidd.zip -L https://gitee.com/Neko-vecter/fluidd-releases/releases/download/v1.23.1/fluidd.zip

echo -e "${COL}Extracting fluidd\n${NC}"
unzip fluidd.zip
rm -rf fluidd.zip

# TODO: curl and mv nginx conf
rm /etc/nginx/http.d/default.conf
curl -o /etc/nginx/http.d/fluidd.conf -C - https://gitee.com/duantong/Octo4a/raw/master/fluidd.conf

cat << EOF
fluidd installed!
EOF